package com.gxa.insurance.controller;

import com.gxa.insurance.pojo.DriverCommentsSensitive;
import com.gxa.insurance.service.SensitiveService;
import com.gxa.insurance.util.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author shen gang
 * @date 2022/6/15
 */
@Api
@RequestMapping("/Sensitive")
@RestController
@ResponseBody
@CrossOrigin
public class SensitiveController {
    @Autowired
    SensitiveService sensitiveService;




    @ApiOperation(value = "查询所用敏感词")
    @PostMapping("/selectAll")
    public Map selectAll(){
        List<DriverCommentsSensitive> driverCommentsSensitives = sensitiveService.selectAll();

        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setMsg("查询成功");
        jsonResult.setData(driverCommentsSensitives);
        return jsonResult.getMap();
    }


    @ApiOperation(value = "添加敏感词")
    @PostMapping("addSenstive")

    public Map addSenstive(@RequestBody DriverCommentsSensitive driverCommentsSensitive){
        sensitiveService.addSenstive(driverCommentsSensitive);
        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setMsg("添加成功");
        return jsonResult.getMap();
    }



}
